package pojo;

/**
 * @author LiangHaiBo
 * @version 1.0
 * @date 2021.9.9 下午 13:04
 *
 * 购物车项
 */
public class CartItem {
    private Product product;//商品
    private int count;//商品数量
    private Double subTotal;//小计金额

    public CartItem(Product product, int count) {
        this.product = product;
        this.count = count;
    }

    public CartItem() {
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public double getSubTotal() {//小计金额获取
        return product.getShop_price()*count;
    }

    @Override
    public String toString() {
        return "CartItem{" +
                "product=" + product +
                ", count=" + count +
                ", subTotal=" + subTotal +
                '}';
    }
}
